package com.scau.XFourPOS.model;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**     
 * 类名称：ProductCategory
 * 类描述：产品类别的model表
 * 创建人：庄祥鹏
 * */
@Entity
@Table(name = "product_category")
public class ProductCategory {
	/**
	 * 构造函数
	 */
	public ProductCategory(String productCategory){
		this.productCategory=productCategory;
	}
	
	/**
	 * 产品类别id
	 */
	@Id
	@Column(name="product_category_id",unique=true,nullable=false )
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int productCategoryId;

	/**
	 * 产品所属的类别，如衣服属于衣服类别
	 */
	@Column(name="product_category",unique=true,nullable=false,length = 50)
	private String productCategory;

	/**
	 *【一个类别】对应【多款产品】 
	 */
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Product.class,mappedBy="productCategory")
	private Set<Product> product;
	
	public int getProductCategoryId() {
		return productCategoryId;
	}

	public void setProductCategoryId(int productCategoryId) {
		this.productCategoryId = productCategoryId;
	}

	public String getProductCategory() {
		return productCategory;
	}

	public void setProductCategory(String productCategory) {
		this.productCategory = productCategory;
	}

	public Set<Product> getProduct() {
		return product;
	}

	public void setProduct(Set<Product> product) {
		this.product = product;
	}
	
}
